import type { TornaDocDetail } from "../types/type";


/**
 * 从接口文档中提取“接口文件名”
 * 
 * 用于生成接口文件
 * 
 * @date 1/24/2024 - 6:20:08 PM
 *
 * @export
 * @param {TornaDocDetail} detail 某个接口文档的详细信息
 * @returns {string} “接口文件名”
 */
export function getApiFileName(detail: TornaDocDetail): string {
  const { url, httpMethod } = detail;
  return url.replace(/\/(\w)/g, (_, v) => v.toUpperCase()) + '_' + httpMethod.toLowerCase();
}

